package com.service.device;

import com.dao.secondary.device.DevicePmdGpsInfoMapper;
import com.model.domain.device.GetDevicePmdGpsInfoDO;
import com.model.pojo.device.DevicePmdGpsInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;


/**
 * @Author: zql
 * @Description: PMD播种机定位信息服务
 * @Data: 2023-06-08
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DevicePmdGpsInfoService {
    private final DevicePmdGpsInfoMapper devicePmdGpsInfoMapper;

    public List<DevicePmdGpsInfo> getPageList(GetDevicePmdGpsInfoDO getDevicePmdGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDevicePmdGpsInfoDO.getPage(), getDevicePmdGpsInfoDO.getPageSize(), getDevicePmdGpsInfoDO.getSortRow() + getDevicePmdGpsInfoDO.getSortOrder());
        return devicePmdGpsInfoMapper.selectList(getDevicePmdGpsInfoDO);
    }

    public List<DevicePmdGpsInfo> getAllList(GetDevicePmdGpsInfoDO getDevicePmdGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy( getDevicePmdGpsInfoDO.getSortRow() + getDevicePmdGpsInfoDO.getSortOrder());
        return devicePmdGpsInfoMapper.selectList(getDevicePmdGpsInfoDO);
    }

    public DevicePmdGpsInfo getById(String tableName,Long id){
        return devicePmdGpsInfoMapper.selectByPrimaryKey(tableName,id);
    }

    public List<Map<String,Object>> getListGroupBy(GetDevicePmdGpsInfoDO getDevicePmdGpsInfoDO){
        return devicePmdGpsInfoMapper.selectListGroupBy(getDevicePmdGpsInfoDO);
    }
}
